package com.atguigu.java;

import org.junit.Test;

import java.util.ArrayList;

/**
 *
 */
public class HelloWord {
    //中文
    public static void  main(String[] args){
        System.out.println("helloWord !!");

        //模板二sout
        System.out.println("hello");
        //变形，soutp/soutm/soutv/xxx.sout
        System.out.println("args = [" + args + "]");//soutp
        System.out.println("HelloWord.main");//soutm
        int num1 = 10;
        System.out.println("num1 = " + num1);//soutv 就近原则
        int num2 = 20;
        System.out.println("num2 = " + num2);//num2.soutv

        //模板三：fori
        String[] arr = new String[]{"Tom","Jerry","HanMeiMei","Lilei"};
        for (int i = 0; i < arr.length; i++) {
            System.out.println("arr[i] = " + arr[i]);
        }
        System.out.println("--------------------");
        //变形：iter
        for (String s : arr) {
            System.out.println("arr[i] = " + s);
        }
        //变形：itar
        for (int i = 0; i < arr.length; i++) {
            String s = arr[i];
            
        }



    }
    @Test
    public void testMethod(){
        method();
    }

    public void method(){
        //模板四:list.for
        ArrayList list = new ArrayList();
        list.add(123);
        list.add(456);
        list.add(789);
        for (Object o : list) {
            System.out.println(o);
        }
        System.out.println("--------------------------");
        //变形：list.fori
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
        System.out.println("-----------------------");
        //变形：list.forr 倒叙遍历
        for (int i = list.size() - 1; i >= 0; i--) {
            System.out.println(list.get(i));
        }
        System.out.println("-----------------------");
        list.forEach(System.out::println);
    }

    @Test
    public void method1(){
        System.out.println("HelloWord.method1");
        String ee = "sadfa";
        //模板五：ifn
        if (ee == null) {}
        //变形：inn
        if (ee != null) {}
        //变形: xxx.nn xxx.null
        if (ee != null) {}
        if (ee == null) {}
    }
    //模板六 prsf :可生成private static final 私有全局常量



}
